#ifndef CURVE_MODEL_H_
#define CURVE_MODEL_H_

#include <vector>
#include <cmath>
#include "model.h"
#include "point.h"

class CurveModel : public Model{
	public:
		typedef std::vector<Point> Points;

	protected:
		Points control;
		Points buffer;
		float matrix[4][4];

	public:
		CurveModel();
		virtual ~CurveModel();

		virtual void addPoint(Point point);
		virtual void removePoint(Point point);
		virtual void movePoint(Point point,Point futurePoint);

		virtual void calculatePoints()=0;

		Points::const_iterator pointsBegin(){ return buffer.begin(); }
		Points::const_iterator pointsEnd(){ return buffer.end(); }
		Points::const_iterator controlPointBegin(){ return control.begin(); }
		Points::const_iterator controlPointEnd(){ return control.end(); }
		Points::const_reverse_iterator controlPointrBegin(){ return control.rbegin(); }
		Points::const_reverse_iterator controlPointrEnd(){ return control.rend(); }
		unsigned int controlSize(){ return this->control.size(); }
		unsigned int bufferSize(){ return this->buffer.size(); }
		Point getLast(){ return this->control.back(); }
		Point getFirst(){ return this->control.front(); }

	protected:
		Point calculatePoint(float u,float* buffer,unsigned int stride);
};

#endif /* CURVE_MODEL_H_ */
